package com.product.android.business.service;

import com.product.android.business.ApplicationVariable;

import android.content.Intent;
import android.os.Bundle;

public class SendBroadcastMsg {

	private Intent intent = null;
	private static SendBroadcastMsg instance = new SendBroadcastMsg();

	public SendBroadcastMsg() {
		intent = new Intent(
				ApplicationVariable.INSTANCE.applicationContext
						.getPackageName() + ".msg");
	}

	/*
	 * 返回一个实例
	 */
	public static SendBroadcastMsg getInstance() {
		// if(instance==null){
		// instance= new SendBroadcastMsg();
		// }
		return instance;
	}

	/**
	 * 发送身份过期广播
	 */
	public void sendNotifyIdentityExpired() {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", BroadcastCMD.CMD_33); // 成功
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent); // 发送广播
	}

	/**
	 * 发送Oap处理完数据 code=1000+type
	 */
	public void sendNotifyProcessComplete(int code) {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", code);
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent); // 发送广播
	}

	/**
	 * 发送通讯录变更通知
	 */
	public void sendNotifyPhoneChangeMsg() {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", BroadcastCMD.CMD_85674); // 正在重连，通知转
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent); // 发送广播
	}

	/**
	 * 发送刷新好友分组列表广播
	 */
	public void sendFriendRefreshBroadCast() {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", BroadcastCMD.CMD_89);
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent); // 发送广播
	}

	public void sendGroupInfoChange(String modifyStr) {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", BroadcastCMD.GROUP_SYSMSG_TYPE_GROUP_INFO_CHANGED);
		bundle.putString("str", modifyStr);
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent); // 发送广播
	}

	public void showToast(String msgData) {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", 2000);
		bundle.putString("msgData", msgData);
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent); // 发送广播
	}

	public void sendNotifyMsg() {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", BroadcastCMD.CMD_31);
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent);
	}

	public void sendNotifyRemoveGroup(long gid) {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", BroadcastCMD.CMD_REMOVE_GROUP); // 删除群
		bundle.putLong("gid", gid);
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent);
	}

	public void sendNotifyGroupMemberRefreshStatus() {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", BroadcastCMD.CMD_REMOVE_GROUP); // 删除群
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent);
	}

	public void sendNotifySignChance() {
		Bundle bundle = new Bundle();
		bundle.putInt("cmd", BroadcastCMD.CMD_30010); // 个性签名变更
		intent.putExtras(bundle);
		ApplicationVariable.INSTANCE.applicationContext.sendBroadcast(intent);
	}
}